import http from '@/utils/http'

export function getList(query, token) {
  return http({
    url: '/resource',
    method: 'get',
    params: query,
    headers: {
      'Authorization': 'Bearer ' + token
    }
  }).then(res => {
    return res.data
  })
}

export function getInfo(id, token) {
  return http({
    url: '/resource/' + id,
    method: 'get',
    headers: {
      'Authorization': 'Bearer ' + token
    }
  })
}

export function add(data, token) {
  return http({
    url: '/resource',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': 'Bearer ' + token
    },
    data
  })
}

export function deleteResource(id, query, token) {
  return http({
    url: '/resource/' + id,
    method: 'delete',
    params: query,
    headers: {
      'Authorization': 'Bearer ' + token
    }
  })
}
